package com.luoqiz.securityrs.controller;

import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class RsTestController {

    @GetMapping(value = "/tests")
    public String test(){
        return "/test/test path 测试";
    }

    @GetMapping("/test1")
    public AuthenticationPrincipal test1(@AuthenticationPrincipal AuthenticationPrincipal user){
        return user;
    }
    @GetMapping("/test2")
    public UserDetails test2(@AuthenticationPrincipal UserDetails user){
        return user;
    }
}
